import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

const store = new Vuex.Store({
	state: {
		isAlreadyLogin: false,
		requestOption: undefined
	},
	mutations: {
		submitStore(state, store) {
			
		},
		loginSuccess(state, autor) {
			state.isAlreadyLogin = true;
			if (state.requestOption) {
				state.requestOption.header["Cookie"] = "JSESSIONID="+state.sessionId;
				uni.request(state.requestOption);
				state.requestOption = undefined;
			}
		},
		loginOut(state) {
			state.isAlreadyLogin = false;
		}
	}
});
export default store;